package com.gmail.avereshchaga.db.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author <a href="mailto:avereshchaga@gmail.com">Vereshchaga Alexey</a>
 */
@Entity
@Table(name = "invoice_items")
public class InvoiceItemsImpl implements IInvoiceItems {

    @Id
    @SequenceGenerator(name = "id", sequenceName = "invoice_item_id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id")
    @Column(name = "id", insertable = false, updatable = false)
    private Long id;
    @ManyToOne(targetEntity = InvoiceImpl.class)
    @JoinColumn(name = "invoices_id")
    private InvoiceImpl invoice;
    @ManyToOne(targetEntity = ItemImpl.class)
    @JoinColumn(name = "items_id")
    private ItemImpl item;
    @Column(name = "quantity")
    private Long quantity;

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public InvoiceImpl getInvoice() {
        return invoice;
    }

    @Override
    public void setInvoice(InvoiceImpl invoice) {
        this.invoice = invoice;
    }

    @Override
    public ItemImpl getItem() {
        return item;
    }

    @Override
    public void setItem(ItemImpl item) {
        this.item = item;
    }

    @Override
    public Long getQuantity() {
        return quantity;
    }

    @Override
    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }
}
